package com.zhuqi.mapper;

import com.zhuqi.domain.SysUser;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SysUserMapper {
    int deleteByPrimaryKey(Integer userid);

    int insert(SysUser record);

    int insertSelective(SysUser record);

    SysUser selectByPrimaryKey(Integer userid);

    int updateByPrimaryKeySelective(SysUser record);

    int updateByPrimaryKey(SysUser record);

    @Select("select * from sys_user where username = #{value}")
    SysUser selectUserByUsername(String username);

    @Select("SELECT DISTINCT tab1.percode FROM sys_permission as tab1 LEFT JOIN sys_role_permission as tab2 on tab2.perid = tab1.id LEFT JOIN sys_user_role as tab3 on tab2.roleid = tab3.roleid WHERE tab3.userid = 1")
    List<String> selectUserPermissionByUserId(Integer userid);
}